package cn.clwxy.gdz.dao;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import cn.clwxy.gdz.entity.Student;
import cn.clwxy.gdz.util.BaseDao;

public class AdminStudentimp extends BaseDao implements AdminStudentDao  {

	@Override
	public List<Student> queryStudents(Integer PageNo) {
		String sql="select studentId,studentName,studentPhone,\n" +
				"studentDate ,studentDesc from student as s where s.isDelete=0 ORDER BY s.studentId desc limit ?,15";
		return super.queryList(sql, new BeanListHandler<Student>(Student.class),(PageNo-1)*15);
		
	}

	@Override
	public Long queryCount() {
		String sql="select count(*)\n" +
				" from student as s where s.isDelete=0 ORDER BY s.studentDate";
		return super.queryColumn(sql, new ScalarHandler());
	}

	@Override
	public int deleteStudent(Integer id) {
		String sql="update student set isDelete=1 where studentId=?";
		
		return super.update(sql, id);
	}

	

	

}
